
const app = new Vue({
    el:'#app',
    data:{
        info:{
            name:'',
            age:0,
            height:0,
            wegiht:0,
            disease:'',
            result:''
        }
    },
    methods:{
        submit(e){
            e.preventDefault();
            let bmi = Number((this.info.wegiht/(this.info.height ^2)).toFixed(2))
            let res = ''
            if(bmi>29){
                res = '肥胖'
            }else if(24.9 < bmi && bmi <=29.9){
                res = '体重过重'
            }else if(18.5< bmi && bmi <=24.9){
                res = '正常'
            }else{
                res = '体重过轻'
            }
            this.info.result = res
        }
    }
})